package olga.gorbatiuk.perdep.sorting.sort.impl;

import olga.gorbatiuk.perdep.sorting.sort.AbstractSort;

/**
 * @author Olga Gorbatiuk
 *
 * @deprecated Just try to do the whole class deprecated.
 */
public class BubbleSortDescending extends AbstractSort {

    /**
     * Sort.
     *
     * @param array the array
     * @deprecated Because Dima says do this method deprecated.
     */
    @Override
    public void sort(int[] array) {
        for (int i = array.length - 1; i > 0; i--) {
            boolean isSwaped = false;
            for (int j = array.length - 1; j > 0; j--) {
                if (array[j] > array[j - 1]) {
                    swap(j, j - 1, array);
                    isSwaped = true;
                }
            }
            if (isSwaped = false) {
                return;
            }
        }
    }
}
